<?php

namespace App\Containers\AppSection\BankDetail\Actions;

use App\Containers\AppSection\BankDetail\Models\BankDetail;
use App\Containers\AppSection\BankDetail\Tasks\DeleteBankDetailTask;
use App\Containers\AppSection\BankDetail\UI\API\Requests\DeleteBankDetailRequest;
use App\Containers\AppSection\Log\Tasks\CreateLogTask;
use App\Ship\Parents\Actions\Action;

class DeleteBankDetailAction extends Action
{
    public function run($id, DeleteBankDetailRequest $request): BankDetail
    {
        $bankDetails = app(DeleteBankDetailTask::class)->run($id);
        app(CreateLogTask::class)->run($request->profile()->id, "Банковские реквизиты №{$bankDetails->id} удалены", 'bankDetail');

        return $bankDetails;
    }
}
